home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Complete Linux
/
Complete Linux.iso
/
docs
/
system
/
manual_p
/
xman_dif.z
/
xman_dif
Wrap
Text File
|
1993-04-06
|
5KB
|
171 lines
Differences for X11R5 xman code to make it look for two different extensions
of compressed manfiles, especially useful on systems using 'gzip', which
can handle both '.Z' and '.z' files.
Put together by Rob Hooft (hooft@chem.ruu.nl).
Enjoy!
=============================================================
diff -cr xman/man.c xman-new/man.c
*** xman/man.c Tue Mar 30 09:54:42 1993
--- xman-new/man.c Mon Apr 5 23:24:58 1993
***************
*** 367,376 ****
* Remove the compression extension from the path name.
*/
! if ( (ptr = rindex(path, '.')) != NULL)
if (streq(ptr + 1, COMPRESSION_EXTENSION))
*ptr = '\0';
!
nentries = local_manual->nentries;
nalloc = local_manual->nalloc;
--- 367,380 ----
* Remove the compression extension from the path name.
*/
! if ( (ptr = rindex(path, '.')) != NULL) {
if (streq(ptr + 1, COMPRESSION_EXTENSION))
*ptr = '\0';
! #ifdef ALTERNATIVE_COMPRESSION_EXTENSION
! if (streq(ptr + 1, ALTERNATIVE_COMPRESSION_EXTENSION))
! *ptr = '\0';
! #endif
! }
nentries = local_manual->nentries;
nalloc = local_manual->nalloc;
***************
*** 396,404 ****
* Remove the compression extension from the entry name.
*/
! if ( (ptr = rindex(full_name, '.')) != NULL)
if (streq(ptr + 1, COMPRESSION_EXTENSION))
*ptr = '\0';
local_manual->entries[nentries] = StrAlloc(full_name);
local_manual->entries_less_paths[nentries] =
rindex(local_manual->entries[nentries], '/');
--- 400,413 ----
* Remove the compression extension from the entry name.
*/
! if ( (ptr = rindex(full_name, '.')) != NULL) {
if (streq(ptr + 1, COMPRESSION_EXTENSION))
*ptr = '\0';
+ #ifdef ALTERNATIVE_COMPRESSION_EXTENSION
+ if (streq(ptr + 1, ALTERNATIVE_COMPRESSION_EXTENSION))
+ *ptr = '\0';
+ #endif
+ }
local_manual->entries[nentries] = StrAlloc(full_name);
local_manual->entries_less_paths[nentries] =
rindex(local_manual->entries[nentries], '/');
diff -cr xman/misc.c xman-new/misc.c
*** xman/misc.c Tue Mar 30 09:55:11 1993
--- xman-new/misc.c Mon Apr 5 23:35:02 1993
***************
*** 206,211 ****
--- 206,218 ----
if ( (file = Uncompress(man_globals, filename)) != NULL)
return(file);
+ #ifdef ALTERNATIVE_COMPRESSION_EXTENSION
+ sprintf(filename, "%s/%s%s/%s.%s", path, CAT,
+ section + len_cat, page, ALTERNATIVE_COMPRESSION_EXTENSION);
+ if ( (file = Uncompress(man_globals, filename)) != NULL)
+ return(file);
+ #endif
+
/*
* And lastly files in a compressed directory.
*
***************
*** 218,223 ****
--- 225,237 ----
COMPRESSION_EXTENSION, page);
if ( (file = Uncompress(man_globals, filename)) != NULL)
return(file);
+
+ #ifdef ALTERNATIVE_COMPRESSION_EXTENSION
+ sprintf(filename, "%s/%s%s.%s/%s", path, CAT, section + len_cat,
+ ALTERNATIVE_COMPRESSION_EXTENSION, page);
+ if ( (file = Uncompress(man_globals, filename)) != NULL)
+ return(file);
+ #endif
/*
* We did not find any preformatted manual pages, try to format it.
*/
***************
*** 442,447 ****
--- 456,471 ----
CAT, section + len_cat, page, COMPRESSION_EXTENSION);
return(TRUE);
}
+
+ #ifdef ALTERNATIVE_COMPRESSION_EXTENSION
+ sprintf(input, "%s.%s", filename, ALTERNATIVE_COMPRESSION_EXTENSION);
+ if ( UncompressNamed(man_globals, input, filename) ) {
+ man_globals->compress = TRUE;
+ sprintf(man_globals->save_file, "%s/%s%s/%s.%s", path,
+ CAT, section + len_cat, page, ALTERNATIVE_COMPRESSION_EXTENSION);
+ return(TRUE);
+ }
+ #endif
/*
* And lastly files in a compressed directory.
*/
***************
*** 454,459 ****
--- 478,495 ----
CAT, section + len_cat, COMPRESSION_EXTENSION, page);
return(TRUE);
}
+
+ #ifdef ALTERNATIVE_COMPRESSION_EXTENSION
+ sprintf(input, "%s/%s%s.%s/%s", path,
+ MAN, section + len_man, ALTERNATIVE_COMPRESSION_EXTENSION, page);
+ if ( UncompressNamed(man_globals, input, filename) ) {
+ man_globals->compress = TRUE;
+ sprintf(man_globals->save_file, "%s/%s%s.%s/%s", path,
+ CAT, section + len_cat, ALTERNATIVE_COMPRESSION_EXTENSION, page);
+ return(TRUE);
+ }
+ #endif
+
return(FALSE);
}
diff -cr xman/vendor.h xman-new/vendor.h
*** xman/vendor.h Tue Mar 30 09:55:40 1993
--- xman-new/vendor.h Mon Apr 5 23:42:33 1993
***************
*** 84,92 ****
# define UNCOMPRESS_FORMAT "ccat < %s > %s"
# define COMPRESS "compact"
# else
! # define COMPRESSION_EXTENSION "Z"
! # define UNCOMPRESS_FORMAT "zcat < %s > %s"
! # define COMPRESS "compress"
# endif /* UTEK */
#endif /* macII, hcx, SYSV386, sgi */
--- 84,99 ----
# define UNCOMPRESS_FORMAT "ccat < %s > %s"
# define COMPRESS "compact"
# else
! # if defined ( linux )
! # define COMPRESSION_EXTENSION "z"
! # define ALTERNATIVE_COMPRESSION_EXTENSION "Z"
! # define UNCOMPRESS_FORMAT "zcat < %s > %s"
! # define COMPRESS "gzip"
! # else
! # define COMPRESSION_EXTENSION "Z"
! # define UNCOMPRESS_FORMAT "zcat < %s > %s"
! # define COMPRESS "compress"
! # endif /* linux */
# endif /* UTEK */
#endif /* macII, hcx, SYSV386, sgi */